package com.ecplatform.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ecplatform.item.pojo.po.Item;
import com.ecplatform.item.pojo.vo.ItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ItemMapper extends BaseMapper<Item> {

    @Select("SELECT " +
            "p.*, c.name as categoryName FROM item p JOIN category c ON p.category_id = c.id " +
            "WHERE status = 1 order by p.id")
    List<ItemVO> itemPageQuery();

    @Select("SELECT * FROM item WHERE id = #{id}")
    ItemVO selectItemById(Long id);
}
